<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //数组的遍历可以使用for循环
        var index = ['wo', 'shi', 'gao', 'wei', 'jie']
        for (var x = 0; x < index.length; x++) {
            console.log(index[x]);

        }
        //同样也可以使用while循环
        var num = ['h', 'e', 'l', 'l', 'o']
        var y = 0;
        while (y < num.length) {
            console.log(num[y]);
            y++;

        }
        //for...in遍历数组
        var index = ['wo', 'shi', 'gao', 'wei', 'jie']
        for (var i in index) {
            console.log(index[i]);


        }
    </script>
</body>

</html>